package com.offcn.play.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PlayConfig {

    @Value("${aliplay.appId}")
    private String appId;

    @Value("${aliplay.privatekey}")
    private String privatekey;

    @Value("${aliplay.alipayPublicKey}")
    private String alipayPublicKey;

    // 签名方式
    @Value("${aliplay.signType}")
    private String signType;

    // 字符编码格式
    @Value("${aliplay.charset}")
    private String charset;

    // 支付宝网关
    @Value("${aliplay.serverUrl}")
    private String serverUrl;


    @Value("${aliplay.format}")
    private String format;

    @Bean
    public AlipayClient getPayClient() {
        return new DefaultAlipayClient(serverUrl, appId, privatekey, format, charset, alipayPublicKey,signType);
    }


}
